on btnSound asoundName -- does a little validation
if stringp(asoundName) and asoundName <> "Silence" then
puppetSound asoundName
end if
end
on getBehaviorDescription
return "- Motion Behavior -"¨
& return & "Defined: controls a single or dual-image button that moves horizontally and/or vertically on mouseDown."¨
& return & "Intended Use: to give user a strong audio + visual feedback that they've engaged a control. Rolling off button during mouseDown will disengage."¨
& return & return & "- Properties -"¨
& return & "MouseDown Image: assigns the castmember used for the mouseDown state. 0 represents the first image, 1 the second, 2 the third, and so on."¨
& return & "Horizontal Motion: assigns the number of pixels the button moves horizontally (negative numbers move left)."¨
& return & "Vertical Motion: assigns the number of pixels the button moves vertically (negative numbers move up)."¨
& return & "Down Sound: assigns a mouseDown button sound."¨
& return & "Up Sound: assigns a mouseUp button sound."¨
& return & "MouseUp Action: assigns a button course of action."¨
& return & " (Note: Select 'None' if you plan to add a seperate mouseUp behavior to this button)"¨
& return & "Destination Marker: assigns a destination to the course of action."¨
& return & return & "(Explore the 'LookHere' folder on the CD-Rom for examples of each behavior)"
end
--- the handler code ---
on motion new, offsetH, offsetV, downSound, upSound
set emem = the membernum of sprite clickon()
set horz = the locH of sprite clickon()
set vert = the locV of sprite clickon()
if stringP(downSound) then btnSound downSound
updatestage
set the membernum of sprite clickon() = (emem + new)
set the loch of sprite clickon() = (horz + offsetH)
set the locv of sprite clickon() = (vert + offsetV)
updatestage
repeat while the stillDown or soundBusy (1)
end repeat
if stringP(upSound) and rollOver(clickOn()) then btnSound upSound -- Apple Legal